/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package terminalapp;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Kostya
 */
class Log {

    private static DateFormat dateFormat = new SimpleDateFormat("hh:mm:ss.SSS");

    private static void write(String aLevel, Object aSender, Object... params){
        StringBuffer buf = new StringBuffer();
        buf.append("["+dateFormat.format(new Date())+"]["+aLevel+"]["+aSender.getClass().getSimpleName()+"]");
        for (Object p : params) {
            buf.append(p);
            buf.append(" ");
        }
        System.err.println(buf);
    }

    static void error(Object aSender, Object... params){
        write("ERROR", aSender, params);
    }
    static void debug(Object aSender, Object... params){
        write("DEBUG", aSender, params);
    }
}
